<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
 
 

<t:datagrid name="userList" title="学生列表" actionUrl="studentController.do?datagrid" 
    fit="true" fitColumns="true" idField="id" queryMode="group">
	<t:dgCol title="common.id" field="id" hidden="true"></t:dgCol>
	<t:dgCol title="common.username" sortable="false" field="userName" query="false"  width="120"></t:dgCol>
	<t:dgCol title="学号" sortable="false" field="staffNo" query="true"  width="120"></t:dgCol>
 	<t:dgCol title="姓名" field="realName" query="true" width="120"></t:dgCol>
	<t:dgCol title="生日"  field="birthday"  formatter="yyyy-MM-dd"   queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="学院"  field="college.collegeName" query="true"  hidden="false"  queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="专业"  field="major.majorName" query="true"  queryMode="single"  width="120"></t:dgCol>
   <%-- <t:dgCol title="系别"  field="series.seriesName"    queryMode="single"  width="120"></t:dgCol> --%>
	<t:dgCol title="年级"  field="grade"  query="true"  queryMode="single"  width="60"></t:dgCol>
	<t:dgCol title="班级"  field="className"    queryMode="single"  width="60"></t:dgCol>
    <t:dgCol title="卡号"  field="cardNo"    queryMode="single"  width="120"></t:dgCol> 
	<%-- <t:dgCol title="common.status" sortable="true" field="status" replace="common.active_1,common.inactive_0,super.admin_-1"
		  width="120"></t:dgCol> --%>
	<t:dgCol title="common.operation" field="opt"  width="120"></t:dgCol>
	<t:dgFunOpt  funname="editItemDetail({'编辑'},{'studentController.do?addorupdate'},id,{'590'},{'380'})" title="编辑"  /> 
	<t:dgDelOpt title="common.delete" url="studentController.do?del&id={id}&userName={userName}" />
	<t:dgToolBar title="录入学生信息" langArg="common.user" icon="icon-add" url="studentController.do?addorupdate" funname="add" width="590" height="380"></t:dgToolBar>
	<%-- <t:dgToolBar title="common.password.reset" icon="icon-edit" url="studentController.do?changepasswordforuser" funname="update" width="500" height="110"></t:dgToolBar> --%>
	<%-- <t:dgToolBar title="common.lock.user" icon="icon-edit" url="studentController.do?lock&lockvalue=0" funname="lockObj"></t:dgToolBar>
	<t:dgToolBar title="common.unlock.user" icon="icon-edit" url="studentController.do?lock&lockvalue=1" funname="unlockObj"></t:dgToolBar> --%>
	<t:dgToolBar title="同步学生数据" icon="icon-put" funname="importData"></t:dgToolBar> 
	<t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
    <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
    <t:dgToolBar title="下载模板" icon="icon-putout" funname="downLoadTemplate"></t:dgToolBar> 
 </t:datagrid>

<script type="text/javascript">

function importData(){
	
	ajaxLoading("正在导入数据请稍后...");
	
	$.ajax({
		url:"studentController.do?importData",
		success:function(data){
			data = $.parseJSON(data);
			tip(data.msg);
			
			ajaxLoadEnd();
			
			reloadTable();
		}
	});
} 


function lockObj(title,url, id) {

	gridname=id;
	var rowsData = $('#'+id).datagrid('getSelections');
	if (!rowsData || rowsData.length==0) {
		tip('<t:mutiLang langKey="common.please.select.edit.item"/>');
		return;
	}
		url += '&id='+rowsData[0].id;

	$.dialog.confirm('<t:mutiLang langKey="common.lock.user.tips"/>', function(){
		lockuploadify(url, '&id');
	}, function(){
	});
}
function unlockObj(title,url, id) {

	gridname=id;
	var rowsData = $('#'+id).datagrid('getSelections');
	if (!rowsData || rowsData.length==0) {
		tip('<t:mutiLang langKey="common.please.select.edit.item"/>');
		return;
	}
		url += '&id='+rowsData[0].id;

	$.dialog.confirm('<t:mutiLang langKey="common.unlock.user.tips"/>', function(){
		lockuploadify(url, '&id');
	}, function(){
	});
}


function lockuploadify(url, id) {
	$.ajax({
		async : false,
		cache : false,
		type : 'POST',
		url : url,// 请求的action路径
		error : function() {// 请求失败处理函数
		
		
		},
		success : function(data) {
			var d = $.parseJSON(data);
			if (d.success) {
			var msg = d.msg;
				tip(msg);
				reloadTable();
			}
			
		}
	});
}

//导入
function ImportXls() {
	openuploadwin('Excel导入', 'studentController.do?upload', "userList");
}

//导出
function ExportXls() {
	JeecgExcelExport("studentController.do?exportXls","userList");
}

function downLoadTemplate(){
	window.location.href="studentController.do?exportTemplate";
}
 


    function choose_297e201048183a730148183ad85c0001() {
        if (typeof(windowapi) == 'undefined') {
            $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey="common.department.list"/>', lock: true, width: 400, height: 350, opacity: 0.4, button: [
                {name: '<t:mutiLang langKey="common.confirm"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},
                {name: '<t:mutiLang langKey="common.cancel"/>', callback: function () {
                }}
            ]});
        } else {
            $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey="common.department.list"/>', lock: true, parent: windowapi, width: 400, height: 350, left: '85%', top: '65%', opacity: 0.4, button: [
                {name: '<t:mutiLang langKey="common.confirm"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},
                {name: '<t:mutiLang langKey="common.cancel"/>', callback: function () {
                }}
            ]});
        }
    }
    function clearAll_297e201048183a730148183ad85c0001() {
        if ($('#departname').length >= 1) {
            $('#departname').val('');
            $('#departname').blur();
        }
        if ($("input[name='departname']").length >= 1) {
            $("input[name='departname']").val('');
            $("input[name='departname']").blur();
        }
        $('#orgIds').val("");
    }
    function clickcallback_297e201048183a730148183ad85c0001() {
        iframe = this.iframe.contentWindow;
        var departname = iframe.getdepartListSelections('text');
        if ($('#departname').length >= 1) {
            $('#departname').val(departname);
            $('#departname').blur();
        }
        if ($("input[name='departname']").length >= 1) {
            $("input[name='departname']").val(departname);
            $("input[name='departname']").blur();
        }
        var id = iframe.getdepartListSelections('id');
        if (id !== undefined && id != "") {
            $('#orgIds').val(id);
            $("input[name='orgIds']").val(id);
        }
    }
    


 
</script>
